<script setup lang="ts">
import { onMounted } from 'vue'
import { storeToRefs } from 'pinia'
import { useClientStore } from '@/store/modules/clientStore'
const clientStore = useClientStore()
const { ofPatientList } = storeToRefs(clientStore)

onMounted(() => {
  clientStore.toObtainListOfPatient()
})
import { useRouter } from 'vue-router'
const router = useRouter()
/** 添加就诊人 */
const addPatient = () => {
  router.push('/user/patient/a_u_patient')
}
</script>

<template>
  <el-card class="container">
    <!-- 就诊人头部 -->
    <div class="doc_header">
      <h1>就诊人管理</h1>
      <el-button icon="User" type="success" @click="addPatient">添加就诊人</el-button>
    </div>
    <!-- 就诊人展示区域 -->
    <div class="doc_content">
      <!-- 就诊人卡片 -->
      <doc_card v-for="(item, index) in ofPatientList" :key="index" :ofPatient="item" isbtn />
      <!-- 空状态 -->
      <el-empty class="empty" v-if="ofPatientList.length === 0" description="无就诊人信息" />
    </div>
  </el-card>
</template>

<style lang="scss" scoped>
.container {
  margin: 30px 0;
  .doc_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 20px 0;
    border-bottom: 1px solid #e6e6e6;
  }
  .doc_content {
    padding: 20px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    .empty {
      margin: 0 auto;
    }
  }
}
</style>
